<?php
return [
    'settings' => [
        'viewTemplatesDirectory' => '../templates',
        'compilation_cache'=>'../templates/caches',
        'displayErrorDetails'=>true,
        'dbconfig'=>[
	    	'host'=>'192.168.1.13',
	    	'user'=>'8c898499-8ee6',
	    	'pass'=>'36b4b45d-e7b2',
	    	'dbname'=>'dbaa79a2df3a54d5ba2b55fc7aac7074c'
	    ],
    ],
    'view' => function ($c) {
		$loader = new Twig_Loader_Filesystem($c['settings']['viewTemplatesDirectory']);
		$view = new Twig_Environment($loader, array(
		    //'cache' => $c['settings']['compilation_cache'],
		    'cache'=>false,
		));
        return $view; //返回twig对象
    },
    'db'=>function($c){
    	$db = $c['settings']['dbconfig'];
        //返回medoo类的对象
	    return new medoo([
			// required
			'database_type' => 'mysql',
			'database_name' => $db['dbname'],
			'server' => $db['host'],
			'username' => $db['user'],
			'password' => $db['pass'],
			'charset' => 'utf8',
			// [optional]
			'port' => 3306,
			// [optional] Table prefix
			'prefix' => 'wp_',
		]);
    },
];